/*

* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Smart-Shop开源商城系统/ Java商城-首选电商平台系统 请务必保留此注释头信息
* |     开源地址: https://gitee.com/ningbo-qishan/gruul-mall
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     可正常分享和学习源码,未经授权 不可商用！
* |     商业版中台购买/开源版商业授权 联系技术客服
* |     官网:  https://www.73app.cn/
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Copyright (c) 2016-2999 宁波启山智软科技有限公司
* |     版权所有 ,侵权必究！
* ------------------------------------------------------------------------

*/
package com.medusa.gruul.finance.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.medusa.gruul.common.core.util.PageUtils;
import com.medusa.gruul.finance.api.entity.FinanceAccount;
import com.medusa.gruul.finance.api.entity.FinanceBrokerageDetail;
import com.medusa.gruul.finance.api.enums.AccountTypeEnum;
import com.medusa.gruul.finance.api.model.AddFinanceAccountDto;
import com.medusa.gruul.finance.model.ApiFinanceAccountVo;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 资金账户 服务类
 * </p>
 *
 * @author alan
 * @since 2020 -02-22
 */
public interface IFinanceAccountService extends IService<FinanceAccount> {
    /**
     * 获取小程序端个人佣金详情
     *
     * @param accountType the account type
     * @param userId      the user id
     * @return com.medusa.gruul.finance.model.ApiFinanceAccountVo finance account vo
     * @author alan
     * @date 2020 /2/22 11:32
     */
    ApiFinanceAccountVo getFinanceAccountVo(AccountTypeEnum accountType, String userId);


    /**
     * 创建账号
     *
     * @param dto the dto
     * @return the finance account
     */
    FinanceAccount addAccount(AddFinanceAccountDto dto);

    /**
     * 通过指定的类型和ID列表获取账户信息列表
     *
     * @param accountType the account type
     * @param ids         the ids
     * @return the by type and ids
     */
    List<FinanceAccount> getByTypeAndIds(AccountTypeEnum accountType, List<Long> ids);

    /**
     * 添加账户冻结余额
     *
     * @param accountType the account type
     * @param userId      the user id
     * @param brokerage   the brokerage
     */
    void addBrokerageFrozen(AccountTypeEnum accountType, Long userId, BigDecimal brokerage);

    /**
     * 添加账户余额
     *
     * @param ass       the ass
     * @param userId    the user id
     * @param brokerage the brokerage
     */
    void addBrokerage(AccountTypeEnum ass, Long userId, BigDecimal brokerage);


    /**
     * 通过指定的类型和ID获取账户信息
     *
     * @param accountType the account type
     * @param userId      the user id
     * @return the by type and id
     */
    FinanceAccount getByTypeAndId(AccountTypeEnum accountType, String userId);

    /**
     * 检查用户是否有未结算的佣金
     *
     * @param accountType the account type
     * @param ids         the ids
     * @return the boolean
     */
    Boolean checkCost(AccountTypeEnum accountType, List<Long> ids);

    /**
     * 添加区域团长的佣金
     *
     * @param areaAssId the area ass id
     * @param brokerage the brokerage
     */
    void addAreaAssBrokerage(Long areaAssId, BigDecimal brokerage);

    /**
     * 减少提货点的冻结佣金
     *
     * @param point
     * @param pointId
     * @param brokerage
     */
    void subBrokerageFrozen(AccountTypeEnum point, Long pointId, BigDecimal brokerage);
}
